New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@jsii/spec

Package Overview
Dependencies
Maintainers
2
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsii/spec

Specification for jsii assemblies

1.109.0
latest
Source
npm
Version published
Weekly downloads
238K
-15.88%
Maintainers
2
Weekly downloads
 
Created

What is @jsii/spec?

@jsii/spec is a package that provides TypeScript interfaces and JSON schema definitions for the jsii specification. It is used to define and validate the structure of jsii assemblies, which are used to enable interoperability between different programming languages.

What are @jsii/spec's main functionalities?

TypeScript Interfaces

This feature allows you to define and work with jsii assemblies using TypeScript interfaces. The code sample demonstrates how to create a basic jsii assembly object.

import { Assembly } from '@jsii/spec';

const assembly: Assembly = {
  schema: 'jsii/0.10.0',
  name: 'my-package',
  version: '1.0.0',
  description: 'A sample jsii package',
  license: 'Apache-2.0',
  dependencies: {},
  bundled: [],
  types: {},
  targets: {}
};
console.log(assembly);

JSON Schema Definitions

This feature provides JSON schema definitions for jsii assemblies, allowing you to validate the structure of your jsii assembly objects. The code sample demonstrates how to use the Ajv library to validate a jsii assembly object against the schema.

const schema = require('@jsii/spec/schema.jsii.json');

const validate = (data) => {
  const Ajv = require('ajv');
  const ajv = new Ajv();
  const validate = ajv.compile(schema);
  const valid = validate(data);
  if (!valid) console.log(validate.errors);
  return valid;
};

const data = {
  schema: 'jsii/0.10.0',
  name: 'my-package',
  version: '1.0.0',
  description: 'A sample jsii package',
  license: 'Apache-2.0',
  dependencies: {},
  bundled: [],
  types: {},
  targets: {}
};

console.log(validate(data));

Other packages similar to @jsii/spec

FAQs

Package last updated on 11 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts